#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n ;
	cin >> n;
	int cnt = n;
//	while ( n % 3 != 0  ) {
//		cnt += n / 3;
//		n = n / 3 + n % 3;
//	}
	int temp = n / 3;

	while (temp) {
		temp = n / 3;
		cnt += temp;
		n %= 3;
		n += temp;
	}
	cout << cnt;
	return 0;
}
